home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / Macintosh Sample Code / SC.013.OOPTESample / UDocument.p < prev    next >
Encoding:
Text File  |  1989-09-30  |  3.7 KB  |  124 lines  |  [TEXT/MPS ]

  1. {---------------------------------------------------------------------
  2. #
  3. #    Apple Macintosh Developer Technical Support
  4. #
  5. #    MultiFinder-Aware Simple TextEdit Sample Application
  6. #
  7. #    OOPTESample
  8. #
  9. #    UDocument.p        -    Pascal Source
  10. #
  11. #    Copyright © 1988, 1989 Apple Computer, Inc.
  12. #    All rights reserved.
  13. #
  14. #    Version:        
  15. #                    1.10                    10/89
  16. #                    1.00                    04/89
  17. #
  18. #    Components:     
  19. #                    BuildOOPTESample        October 1, 1989
  20. #                    MOOPTESample.p            October 1, 1989
  21. #                    OOPTESample.make        October 1, 1989
  22. #                    TECommon.h                October 1, 1989
  23. #                    TESampleGlue.a            October 1, 1989
  24. #                    TESample.r                October 1, 1989
  25. #                    UApplication.p            October 1, 1989
  26. #                    UApplication.inc1.p        October 1, 1989
  27. #                    UDocument.p                October 1, 1989
  28. #                    UDocument.inc1.p        October 1, 1989
  29. #                    UTEDocument.p            October 1, 1989
  30. #                    UTEDocument.inc1.p        October 1, 1989
  31. #                    UTESample.p                October 1, 1989
  32. #                    UTESample.inc1.p        October 1, 1989
  33. #
  34. ---------------------------------------------------------------------}
  35.  
  36. UNIT UDocument;
  37.  
  38. INTERFACE
  39.  
  40. USES
  41.     Types, QuickDraw, Events, Desk, ToolUtils, OSUtils, Controls,
  42.     TextEdit, Traps, Windows, Dialogs, 
  43.     ObjIntf;
  44.  
  45. TYPE
  46.     TDocument = OBJECT(TObject)
  47.         fDocWindow: WindowPtr;
  48.         
  49.         PROCEDURE TDocument.IDocument(resID: integer);
  50.         PROCEDURE TDocument.Free; OVERRIDE;
  51.         
  52.         { You will need to override these in your subclasses, since they }
  53.         { do nothing by default. }
  54.         PROCEDURE TDocument.DoZoom(partCode: integer);
  55.         PROCEDURE TDocument.DoGrow(theEvent: EventRecord);
  56.         PROCEDURE TDocument.DoContent(theEvent: EventRecord);
  57.         PROCEDURE TDocument.DoKeyDown(theEvent: EventRecord);
  58.         PROCEDURE TDocument.DoActivate(becomingActive: Boolean);
  59.         PROCEDURE TDocument.DoUpdate;
  60.         
  61.         { File Handling Routines }
  62.         PROCEDURE TDocument.DoOpen;
  63.         PROCEDURE TDocument.DoClose;    { By default, we just delete ourself. }
  64.         PROCEDURE TDocument.DoSave;
  65.         PROCEDURE TDocument.DoSaveAs;
  66.         PROCEDURE TDocument.DoRevert;
  67.         PROCEDURE TDocument.DoPrint;
  68.         
  69.         { Standard Edit Menu actions }
  70.         PROCEDURE TDocument.DoUndo;
  71.         PROCEDURE TDocument.DoCut;
  72.         PROCEDURE TDocument.DoCopy;
  73.         PROCEDURE TDocument.DoPaste;
  74.         PROCEDURE TDocument.DoClear;
  75.         PROCEDURE TDocument.DoSelectAll;
  76.         
  77.         { Idle Time routines: you can use these to do cursor handling, }
  78.         { TE caret blinking, marquee effects, etc. }
  79.         PROCEDURE TDocument.DoIdle;
  80.         FUNCTION TDocument.CalcIdle:Longint;
  81.         PROCEDURE TDocument.AdjustCursor(where: Point); { where is in local coords. }
  82.  
  83.         { Query state of document - useful for adjusting menu state }
  84.         FUNCTION TDocument.HaveUndo: Boolean;
  85.         FUNCTION TDocument.HaveSelection: Boolean;
  86.         FUNCTION TDocument.HavePaste: Boolean;
  87.         FUNCTION TDocument.CanClose: Boolean;
  88.         FUNCTION TDocument.CanSave: Boolean;
  89.         FUNCTION TDocument.CanSaveAs: Boolean;
  90.         FUNCTION TDocument.CanRevert: Boolean;
  91.         FUNCTION TDocument.CanPrint: Boolean;
  92.         
  93.         { Utility routine to get window pointer for document }
  94.         FUNCTION TDocument.GetDocWindow: WindowPtr;
  95.     END;
  96.         
  97.         
  98.     TDocumentLink = OBJECT(TObject)
  99.         fNext: TDocumentLink;
  100.         fDoc: TDocument;
  101.         
  102.         PROCEDURE TDocumentLink.IDocumentLink(n:TDocumentLink; v:TDocument);
  103.         FUNCTION TDocumentLink.GetNext:TDocumentLink;
  104.         FUNCTION TDocumentLink.GetDoc: TDocument;
  105.         PROCEDURE TDocumentLink.SetNext(aLink:TDocumentLink);
  106.         PROCEDURE TDocumentLink.SetDoc(aDoc:TDocument);
  107.     END;
  108.  
  109.     TDocumentList = OBJECT(TObject)
  110.         fDocList: TDocumentLink;    { the first link in our list }
  111.         fNumDocs: integer;            { the number of elements in the list }
  112.         
  113.         PROCEDURE TDocumentList.IDocumentList;
  114.         PROCEDURE TDocumentList.AddDoc(doc:TDocument);
  115.         PROCEDURE TDocumentList.RemoveDoc(doc:TDocument);
  116.         FUNCTION TDocumentList.FindDoc(window:WindowPtr): TDocument;
  117.         FUNCTION TDocumentList.NumDocs:integer;
  118.     END;
  119.         
  120. IMPLEMENTATION
  121.  
  122. {$I UDocument.inc1.p}
  123.  
  124. END.